/**
 * @author: Niimp
 * @date: 2023/11/30 13:02
 * @statement:
 */
package com.dmgis.hndz.service.impl;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.dmgis.hndz.service.UserInfoService;
import com.dmgis.hndz.mapper.UserInfoMapper;
import com.dmgis.hndz.pojo.Ggyh01a;
import com.dmgis.hndz.pojoVo.LoginVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserInfoServiceImpl implements UserInfoService {
    @Resource
    private UserInfoMapper userInfoMapper;


    @DS("slave_qxdata")
    @Override
    public LoginVo login(JSONObject jsonObject) {
        if (JSONUtil.parseObj(jsonObject).isEmpty()) {
            return new LoginVo(null, "用户名或密码为空!");
        }
        String ggyh01a020 = jsonObject.getString("ggyh01a020"); //账号
        String ggyh01a030 = jsonObject.getString("ggyh01a030"); //密码

        Ggyh01a ggyh01a = userInfoMapper.queryUserInfo(ggyh01a020,ggyh01a030);
        return new LoginVo(ggyh01a,"登陆成功!");
    }
}


